package com.fenghongzhang.day009;

import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.ScrollView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private ScrollView ss;
    private TextView text;
    private ListView lv;
    private TextView text1;
    private TextView text2;
    private static final String TAG = "MainActivity";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ss = (ScrollView) findViewById(R.id.ss);
        text = (TextView) findViewById(R.id.text);
        lv = (ListView) findViewById(R.id.lv);
        text1 = (TextView) findViewById(R.id.text1);
        text2 = (TextView) findViewById(R.id.text2);

        List<String> list = new ArrayList<>();
        list.add("啊哈哈哈");
        list.add("啊哈哈哈");
        list.add("啊哈哈哈");
        list.add("啊哈哈哈");
        list.add("啊哈哈哈");
        list.add("啊哈哈哈");
        list.add("啊哈哈哈");
        list.add("啊哈哈哈");
        list.add("啊哈哈哈");

        ViewGroup.LayoutParams layoutParams = lv.getLayoutParams();
        layoutParams.height = 300;
        lv.setLayoutParams(layoutParams);

        lv.setAdapter(new ArrayAdapter<>(this,android.R.layout.simple_list_item_1,list));


        lv.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                lv.getParent().requestDisallowInterceptTouchEvent(true);
                return false;
            }
        });


    }


}
